#!/bin/bash

TIMESTAMP=$(date +%Y%m%d-%H%M%S)
OPENAI_KEY="REDACTED"

curl -s -D >(grep -i x-request-id >&2) \
  -o >(jq -r '.data[0].b64_json' | base64 --decode > "${TIMESTAMP}-out.png") \
  -X POST "https://api.openai.com/v1/images/edits" \
  -H "Authorization: Bearer ${OPENAI_KEY}" \
  -F "model=gpt-image-1" \
  -F "quality=medium" \
  -F "image[]=@reference.png" \
  -F 'prompt=Similar in art style to the attached, cartoon drawing of a cute baby swan, looking upward, holding a red blanket with white trim with black dots. 1:1.4 ratio'
